/*
 * Created by wangzhuozhou on 2015/08/12.
 * Copyright 2015－2019 Sensors Data Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.sensorsdata.analytics.android.plugin

import org.objectweb.asm.Opcodes


class SensorsAnalyticsHookConfig {
    /**
     * android.gradle 3.2.1 版本中，针对 Lambda 表达式处理
     */

    public final static HashMap<String, SensorsAnalyticsMethodCell> LAMBDA_METHODS = new HashMap<>()
    static {

        //L1
        //    LINENUMBER 245 L1
        //    ALOAD 0
        //    NEW com/starblink/android/basic/ext/ViewExtKt$click$1
        //    DUP
        //    ALOAD 0
        //    ALOAD 1
        //    INVOKESPECIAL com/starblink/android/basic/ext/ViewExtKt$click$1.<init> (Landroid/view/View;Lkotlin/jvm/functions/Function1;)V
        //    CHECKCAST android/view/View$OnClickListener
        //    INVOKEVIRTUAL android/view/View.setOnClickListener (Landroid/view/View$OnClickListener;)V
        //   L2

        SensorsAnalyticsMethodCell onClick = new SensorsAnalyticsMethodCell(
                'onClick',
                '(Landroid/view/View;)V',
                'Landroid/view/View$OnClickListener;',
                'trackViewOnClick',
                '(Landroid/view/View;)V',
                1, 1,
                [Opcodes.ALOAD])
        LAMBDA_METHODS.put(onClick.parent + onClick.name + onClick.desc, onClick)
        // Todo: 扩展
    }
}